﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuDada.Core.SystemApplications;
using WuDada.Core.SystemApplications.Service;
using WuDada.Core.SystemApplications.Domain;
using WuDada.Core.Post;
using WuDada.Core.Post.Service;

public partial class index : System.Web.UI.Page
{
    private SystemFactory m_SystemFactory;
    private ISystemService m_SystemService;
    private PostFactory m_PostFactory;
    private IPostService m_PostService;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_SystemFactory = new SystemFactory();
        m_SystemService = m_SystemFactory.GetSystemService();
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            LoadVOToUI();
            FillWitness();
            FillAdv();
        }
    }

    private void FillAdv()
    {
        //搜尋條件
        Dictionary<string, string> conditions = new Dictionary<string, string>();
        conditions.Add("NodeId", "25");
        conditions.Add("Flag", "1");

        RepeaterAdv.DataSource = m_PostService.GetPostList(conditions);
        RepeaterAdv.DataBind();
    }

    private void FillWitness()
    {
        //搜尋條件
        Dictionary<string, string> conditions = new Dictionary<string, string>();
        conditions.Add("NodeId", "22");
        conditions.Add("Flag", "1");

        RepeaterWitness.DataSource = m_PostService.GetPostList(conditions);
        RepeaterWitness.DataBind();
    }

    private void LoadVOToUI()
    {
        //FacebookCode
        SystemParamVO systemParamVO = m_SystemService.GetSystemParamById(1);
        ltlFacebookCode.Text = systemParamVO.FacebookCode;
    }
}